#!/usr/bin/python
#coding=utf-8
import win32ras
import time
def connect(dialname,account,passwd):
    u"""
    dialname 我的连接名称，在网络连接里可手动重命名,account 用户名,passwd 密码
    """
    dial_params = (dialname, '', '', account, passwd, '')
    handle, result = win32ras.Dial(None, None, dial_params, None)
    return handle,result
def disconnect(handle):
    if handle != None:
        try:
            win32ras.HangUp(handle)
            print "Disconnection success!"
        except:
            time.sleep(2)
            disconnect()
